MK8S-184 - Add restart script to react when control plane ingress change#4822
MK8S-184 - Add restart script to react when control plane ingress change#4822bert-e merged 12 commits intodevelopment/133.0from
Conversation
Hello chengyanjin,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
1a109d4 to
103f7c0
Compare
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
103f7c0 to
8498223
Compare
8498223 to
092df26
Compare
a6bb1c3 to
42b899c
Compare
salt/metalk8s/addons/nginx-ingress-control-plane/deployed/tls-secret.sls
Show resolved
Hide resolved
TeddyAndrieux
left a comment
There was a problem hiding this comment.
I do not really like using script in configmap like that 😕 but I don't have any quick easy way to handle it so ... let's go like this for now
salt/metalk8s/addons/prometheus-operator/deployed/oidc-proxy-restart-script.sls
Outdated
Show resolved
Hide resolved
salt/metalk8s/addons/prometheus-operator/deployed/oidc-proxy-restart-script.sls
Outdated
Show resolved
Hide resolved
salt/metalk8s/addons/prometheus-operator/deployed/files/restart-on-ca-change.py
Show resolved
Hide resolved
salt/metalk8s/addons/prometheus-operator/deployed/oidc-proxy-alertmanager.sls
Outdated
Show resolved
Hide resolved
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
1db7250 to
a7ff0d9
Compare
a7ff0d9 to
ab2f406
Compare
| @@ -0,0 +1,208 @@ | |||
| """Tests for the restart-on-ca-change.py script.""" | |||
There was a problem hiding this comment.
Missing __init__.py in salt/tests/unit/scripts/. Every other test subdirectory under salt/tests/unit/ has one (e.g. formulas/, mocks/). Without it, pytest with the default import mode may not discover these tests.
— Claude Code
| - name: restart-script | ||
| configMap: | ||
| name: oidc-proxy-restart-script | ||
| defaultMode: "0555" |
There was a problem hiding this comment.
defaultMode should be an integer (0555), not a string ("0555"). Kubernetes accepts strings here but interprets them as decimal — "0555" becomes octal 01053 (decimal 555), which is not what you want. Use an unquoted integer instead.
— Claude Code
|
17e78ea to
60f0f10
Compare
| - name: restart-script | ||
| configMap: | ||
| name: oidc-proxy-restart-script | ||
| defaultMode: "0555" |
There was a problem hiding this comment.
defaultMode in Kubernetes expects an integer, not a string. 0555 quoted is a YAML string and may be passed as-is to the API, where it could be rejected or misinterpreted. Use the unquoted octal literal 0555 (YAML interprets this as decimal 365) or just 365. The existing thanos-chart.sls uses defaultMode: 420 (integer) as a reference.
— Claude Code
|
| - name: restart-script | ||
| configMap: | ||
| name: oidc-proxy-restart-script | ||
| defaultMode: "0555" |
There was a problem hiding this comment.
defaultMode expects an integer, not a string. "0555" will be passed as the string "0555" to the Kubernetes API, which expects a decimal integer. Octal 0555 = decimal 365. The rest of the codebase uses unquoted decimal integers (e.g., defaultMode: 420 for 0644).
— Claude Code
Review by Claude Code |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
|
/approve |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: The following options are set: approve |
In the queueThe changeset has received all authorizations and has been added to the The changeset will be merged in:
The following branches will NOT be impacted:
There is no action required on your side. You will be notified here once IMPORTANT Please do not attempt to modify this pull request.
If you need this pull request to be removed from the queue, please contact a The following options are set: approve |
|
I have successfully merged the changeset of this pull request
The following branches have NOT changed:
Please check the status of the associated issue MK8S-184. Goodbye chengyanjin. |
Component: Salt
Context:
This PR adds an automatic restart mechanism for the oauth2-proxy deployments when the CA certificate secret changes.
When OIDC authentication is enabled, the oauth2-proxy pods use a k8s-sidecar to sync the CA certificate from a Kubernetes secret. However, when the CA secret is updated (e.g., certificate rotation), the oauth2-proxy process keeps using the old CA loaded in memory, causing authentication failures.
Summary:
Leverage the k8s-sidecar's SCRIPT feature to run a Python script whenever the CA secret changes. The script:
Acceptance criteria:
When the CA secret data changes, the oauth2-proxy pods (prometheus and alertmanager) are automatically restarted via a rolling restart.
[Closes: #MK8S-184]